<?php

namespace app\common\model;

use think\Env;
use think\Exception;
use think\Model;

/**
 * 模型
 */
class CarSeries extends Model
{

    // 表名
    protected $name = 'car_series';

    // 自动写入时间戳字段
    protected $autoWriteTimestamp = false;

    // 定义时间戳字段名
    protected $createTime = false;
    protected $updateTime = false;
    protected $deleteTime = false;


    // 追加属性
    protected $append = [

    ];


    public function brands()
    {
        return $this->belongsTo('CarBrands', 'brand_id', 'id', [], 'LEFT')->setEagerlyType(0);
    }


    public static function geSeriesByBrandId($brandId)
    {
        return self::field('id series_id,name')->where('brand_id',$brandId)->order('id asc')->select()->toArray();
    }

    public static function geSeriesByBrandIdNew($brandId)
    {
        return self::field('id,name')->where('brand_id',$brandId)->order('id asc')->select()->toArray();
    }




}
